
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from common.base_page import BasePage

class RegisterPage(BasePage):

    def __init__(self,driver):
        # self.driver=webdriver.Chrome()
        # self.driver=driver
        super().__init__(driver)

    username_locator=(By.ID,'username')
    email_locator=(By.ID,'email')
    password_locator=(By.ID,'password1')
    conform_password=(By.ID,"conform_password")
    phone = (By.NAME,'extend_field5')
    submitbtn=(By.NAME,'Submit')

    def register_username(self,username):
        # self.driver.find_element(*self.username_locator).send_keys(username)
        # self.driver.find_element(*self.username_locator).send_keys(Keys.TAB)
        self.input(self.username_locator,username,'注册模块_注册功能_用户名输入操作')
        self.input(self.username_locator,Keys.TAB,'注册模块_注册功能_用户名输入操作')

    def register_email(self,email):
        # self.driver.find_element(*self.email_locator).send_keys(email)
        # self.driver.find_element(*self.email_locator).send_keys(Keys.TAB)
        self.input(self.email_locator,email,'注册模块_注册功能_email输入操作')
        self.input(self.email_locator,Keys.TAB,'注册模块_注册功能_email输入操作')

    def register_password(self,password):
        # self.driver.find_element(*self.email_locator).send_keys(email)
        # self.driver.find_element(*self.email_locator).send_keys(Keys.TAB)
        self.input(self.password_locator,password,'注册模块_注册功能_password输入操作')
        self.input(self.password_locator,Keys.TAB,'注册模块_注册功能_password输入操作')


    def register_repassword(self,repassword):
        # self.driver.find_element(*self.email_locator).send_keys(email)
        # self.driver.find_element(*self.email_locator).send_keys(Keys.TAB)
        self.input(self.conform_password,repassword,'注册模块_注册功能_repassword输入操作')
        self.input(self.conform_password,Keys.TAB,'注册模块_注册功能_repassword输入操作')


    def register_phone(self,phone):
        # self.driver.find_element(*self.email_locator).send_keys(email)
        # self.driver.find_element(*self.email_locator).send_keys(Keys.TAB)
        self.input(self.phone,phone,'注册模块_注册功能_phone输入操作')
        self.input(self.phone,Keys.TAB,'注册模块_注册功能_phone输入操作')

    def btn(self):
        self.click(self.submitbtn,'注册模块_注册功能_注册按钮点击操作')


